import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CollageCompensationLogVO, CollageCompensationLogForm, CollageCompensationLogQuery } from '@/api/system/collageCompensationLog/types';

/**
 * 查询拼团补差记录列表
 * @param query
 * @returns {*}
 */

export const listCollageCompensationLog = (query?: CollageCompensationLogQuery): AxiosPromise<CollageCompensationLogVO[]> => {
  return request({
    url: '/system/collageAccountLog/queryCollageCompensationLogPage',
    method: 'get',
    params: query
  });
};

/**
 * 查询拼团补差记录详细
 * @param id
 */
export const getCollageCompensationLog = (id: string | number): AxiosPromise<CollageCompensationLogVO> => {
  return request({
    url: '/system/collageCompensationLog/' + id,
    method: 'get'
  });
};

/**
 * 新增拼团补差记录
 * @param data
 */
export const addCollageCompensationLog = (data: CollageCompensationLogForm) => {
  return request({
    url: '/system/collageCompensationLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改拼团补差记录
 * @param data
 */
export const updateCollageCompensationLog = (data: CollageCompensationLogForm) => {
  return request({
    url: '/system/collageCompensationLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除拼团补差记录
 * @param id
 */
export const delCollageCompensationLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/collageCompensationLog/' + id,
    method: 'delete'
  });
};
